#include<iostream>
using namespace std;
typedef long long LL;
const int N = 4399;
int n;
int main()
{
	cin >> n;
	LL ans = (1 + n) * n / 2;
	cout << ans % N << endl;
	return 0;
}